<?
require_once (__DIR__."/../classes/DB/DicionarioDB.php");

if(isset($_GET["param"])){
	$dicionarioDB = new DicionarioDB();
	$sugestoes = $dicionarioDB->procurarPalavra($_GET["param"],5);
	$count = mysql_num_rows($sugestoes);
}else{
	$sugestoes = array();
	$count = 0;
}
$array = array();
$i = 0;
if($count > 0 ){
	while($row = mysql_fetch_assoc($sugestoes)){
		if(isset($row["palavra"]))
			$array[$i++] = utf8_decode($row["palavra"]);
	}
}else{
	
}
echo (json_encode($array));
?>